<template>
    <div class="main">
      <h2>{{ mail.subject }}</h2>
      <p>From: {{ mail.from }}</p>
      <p>To: {{ mail.to.join(', ') }}</p>
      <div v-html="mail.body"></div>
    </div>
  </template>
  <script>
  import { ref, onMounted } from 'vue';
  export default {
    setup() {
      const mail = ref({});
      onMounted(() => {
        const id = window.location.pathname.split('/').pop();
        // 假数据获取
        mail.value = MOCK_DATA.find(m => m.id === id) || {};
      });
      return { mail };
    }
  };
  </script>